package pd.struct;

import java.util.LinkedList;

/**
 * A mapping between trees represented as a set of operation pairs. This class is protected.
 *
 * @author Joshua Swank
 */
class EditMapping
{
    /**
     * A list of all operation pairs in the mapping. It is a LinkedList because it doesn't need to be accessed by indices.
     */
    private final LinkedList<OperationPair> operations = new LinkedList<OperationPair>();

    /**
     * Initializes a new edit mapping.
     */
    protected EditMapping()
    {
    }

    /**
     * Returns the cost of the edit mapping.
     *
     * @return the cost of the mapping.
     */
    public double getCost()
    {
        double cost = 0.0;

        for( OperationPair o : operations )
            cost += o.getCost();

        return cost;
    }
}
